import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import { defineAsyncComponent } from 'vue'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: '/hello'
  } ,
  {
    path: '/hello',
    name: 'hello',
    component: defineAsyncComponent({
      loader: () => import('../components/HelloWorld.vue'),
      delay: 0,
      timeout: 3000
    })
  },
  {
    path: '/first',
    name: 'first',
    component: defineAsyncComponent({
      loader: () => import('../components/First.vue'),
      delay: 0,
      timeout: 3000
    })
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router